Skip to main content
Version: Capstone Spring 2025 (Archived)

API Spec

CLOVER API (1.0)

Download OpenAPI specification:Download

REST API for CLOVER.

Authentication

AnonymousAuthHandler handles anonymous user authentication

Allows users to log in or sign up anonymously using a shared password and optional code

Request Body schema: application/json

Anonymous authentication request payload

classId
string
code
string
isConsent
boolean

Responses

Request samples

Content type
application/json
{
  • "classId": "string",
  • "code": "string",
  • "isConsent": true
}

Response samples

Content type
application/json
{
  • "property1": "string",
  • "property2": "string"
}

HandleLogin processes user login requests

Authenticates a user using email and password

Request Body schema: application/json

Login request payload

email
string
password
string

Responses

Request samples

Content type
application/json
{
  • "email": "string",
  • "password": "string"
}

Response samples

Content type
application/json
{
  • "property1": "string",
  • "property2": "string"
}

ProviderHandler initiates third-party provider authentication

Redirects the user to the third-party provider's authentication page

path Parameters
provider
required
string

Third-party provider (e.g., google, github)

query Parameters
redirect_to
string

URL to redirect to after authentication

Responses

Response samples

Content type
application/json
"string"

HandleSignUp processes user signup requests

Registers a new user using email, password, first name, and last name

Request Body schema: application/json

Signup request payload

email
string
firstName
string
isConsent
boolean
lastName
string
password
string

Responses

Request samples

Content type
application/json
{
  • "email": "string",
  • "firstName": "string",
  • "isConsent": true,
  • "lastName": "string",
  • "password": "string"
}

Response samples

Content type
application/json
{
  • "property1": "string",
  • "property2": "string"
}

Classes

GetAllClasses retrieves all classes with optional pagination and filtering

Fetches all classes, with options for pagination, searching, and filtering by user

query Parameters
includeStudents
boolean

Whether to include enrolled students in the response

page
integer

Page number for pagination (default is 1)

limit
integer

Number of items per page for pagination (default is 50)

search
string

Search term to filter classes by title or code

user_id
string

Filter classes by a specific user ID (instructor or student)

Responses

Response samples

Content type
application/json
{ }

CreateClass creates a new class

Creates a new class in the database with the provided details

Request Body schema: application/json

Class creation request

classCode
string
classDescription
string
classHexColor
string
classImageCover
string
classTitle
string
instructorId
string

Responses

Request samples

Content type
application/json
{
  • "classCode": "string",
  • "classDescription": "string",
  • "classHexColor": "string",
  • "classImageCover": "string",
  • "classTitle": "string",
  • "instructorId": "string"
}

Response samples

Content type
application/json
{
  • "property1": "string",
  • "property2": "string"
}

UpdateEnrollmentStatus updates a user's enrollment status in a class

Updates the enrollment status of a user in a specific class

Request Body schema: application/json

Enrollment status update request

classId
required
string
status
required
string
userId
required
string

Responses

Request samples

Content type
application/json
{
  • "classId": "string",
  • "status": "string",
  • "userId": "string"
}

Response samples

Content type
application/json
{
  • "property1": "string",
  • "property2": "string"
}

GetClassesByInstructor retrieves classes taught by a specific instructor

Fetches all classes associated with the given instructor ID. Optionally includes enrolled students

path Parameters
instructor_id
required
string

Instructor ID

query Parameters
includeStudents
boolean

Whether to include enrolled students in the response

Responses

Response samples

Content type
application/json
[
  • {
    }
]

RegisterClass registers a user to a class

Registers a user to a class in the database

Request Body schema: application/json

Class registration request

classId
required
string
userId
required
string

Responses

Request samples

Content type
application/json
{
  • "classId": "string",
  • "userId": "string"
}

Response samples

Content type
application/json
{
  • "property1": "string",
  • "property2": "string"
}

UnregisterClass unregisters a user from a class

Unregisters a user from a specific class in the database

Request Body schema: application/json

Class unregistration request

classId
required
string
userId
required
string

Responses

Request samples

Content type
application/json
{
  • "classId": "string",
  • "userId": "string"
}

Response samples

Content type
application/json
{
  • "property1": "string",
  • "property2": "string"
}

GetAClass retrieves a specific class by ID

Fetches a class from the database based on the provided class ID. Optionally includes enrolled students and enrollment status for a specific user

path Parameters
class_id
required
string

ID of the class

query Parameters
includeStudents
boolean

Whether to include enrolled students in the response

user_id
string

User ID to get enrollment status for (optional)

Responses

Response samples

Content type
application/json
{
  • "classCode": "string",
  • "classDescription": "string",
  • "classHexColor": "string",
  • "classImageCover": "string",
  • "classTitle": "string",
  • "createdAt": "string",
  • "enrollmentStatus": "WAITLISTED",
  • "id": "string",
  • "instructorId": "string",
  • "instructorName": "string",
  • "joinedAt": "string",
  • "studentCount": 0,
  • "students": [
    ]
}

UpdateClass updates an existing class

Updates the details of an existing class in the database

path Parameters
class_id
required
string

ID of the class to update

Request Body schema: application/json

Class update request

classCode
string
classDescription
string
classHexColor
string
classImageCover
string
classTitle
string
instructorId
string

Responses

Request samples

Content type
application/json
{
  • "classCode": "string",
  • "classDescription": "string",
  • "classHexColor": "string",
  • "classImageCover": "string",
  • "classTitle": "string",
  • "instructorId": "string"
}

Response samples

Content type
application/json
{
  • "property1": "string",
  • "property2": "string"
}

DeleteClass deletes a class by ID

Deletes a class from the database based on the provided class ID

path Parameters
class_id
required
string

ID of the class to delete

Responses

Response samples

Content type
application/json
{ }

UpdateClassStudentsSettings updates settings for multiple students in a class

Updates the user settings for multiple students enrolled in a specific class

path Parameters
class_id
required
string

ID of the class

Request Body schema: application/json

Settings update request

required
object (models.UserSettings)
studentIds
required
Array of strings

Responses

Request samples

Content type
application/json
{
  • "settings": {
    },
  • "studentIds": [
    ]
}

Response samples

Content type
application/json
{ }

Data Export

ExportAllData exports all user data in JSON format

Exports all user data from the database in JSON format for download

Responses

Response samples

Content type
application/json
"string"

Storage

Handle image upload

Endpoint to handle image uploads to Supabase Storage

Request Body schema: multipart/form-data
image
required
string <binary>

Image file to upload

Responses

Response samples

Content type
application/json
{
  • "error": "string",
  • "image_path": "string",
  • "image_url": "string",
  • "success": true
}

Handle image deletion

Endpoint to handle image deletions from Supabase Storage

path Parameters
image_path
required
string

Path of the image to delete

Responses

Response samples

Content type
application/json
{ }

Logger

GetAllErrorsHandler retrieves all logged errors

Fetches all error logs from the database

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Logs

GetAllLogs retrieves all logs from the database

Fetches all logs from the database

Responses

Response samples

Content type
application/json
[
  • {
    }
]

GetLogsByClassID retrieves logs for a specific class

Fetches logs from the database for a specific class ID

path Parameters
class_id
required
string

ID of the class

Responses

Response samples

Content type
application/json
[
  • {
    }
]

HandleLogsForInstructor retrieves logs for a specific instructor

Fetches logs from the database for a specific instructor ID

path Parameters
instructor_id
required
string

ID of the instructor

Responses

Response samples

Content type
application/json
[
  • {
    }
]

LogSuggestionEvent logs a suggestion event

Logs a suggestion event to the database based on the mode

path Parameters
mode
required
string

Mode of the suggestion (CODE_BLOCK, LINE_BY_LINE, CODE_SELECTION)

Request Body schema: application/json

Log Suggestion Event Request

any

Responses

Request samples

Content type
application/json
null

Response samples

Content type
application/json
{
  • "property1": "string",
  • "property2": "string"
}

GetUserSuggestionLogsByMode retrieves suggestion logs for a user based on GetUserSuggestionLogsByMode

Fetches suggestion logs from the database for a specific user and mode

path Parameters
user_id
required
string

ID of the user

mode
required
string

Mode of the suggestion logs to retrieve (CODE_BLOCK, LINE_BY_LINE, CODE_SELECTION)

Responses

Response samples

Content type
application/json
{ }

GetUserTypingLogs retrieves typing logs and statistics for a specific user

Fetches typing logs and statistics from the database for a specific user ID and mode

path Parameters
user_id
required
string

ID of the user

query Parameters
mode
required
string

Mode of typing logs to retrieve (block, line, or selection)

interval_type
string

Type of interval for statistics (days, weeks, months, hours, minutes). Default is days.

interval_count
integer

Number of intervals to retrieve. Default is 30.

Responses

Response samples

Content type
application/json
{
  • "logs": [
    ],
  • "totalAccepted": 0,
  • "totalTyped": 0,
  • "typingRate": 0
}

LogUserTyping logs typing statistics for a user

Logs typing statistics to the database for a specific user

path Parameters
user_id
required
string

ID of the user

Request Body schema: application/json

Typing Statistics Request

accepted_number
integer
suggestion_id
string
suggestion_line_id
string
suggestion_selection_item_id
string
typed_number
integer

Responses

Request samples

Content type
application/json
{
  • "accepted_number": 0,
  • "suggestion_id": "string",
  • "suggestion_line_id": "string",
  • "suggestion_selection_item_id": "string",
  • "typed_number": 0
}

Response samples

Content type
application/json
{
  • "property1": "string",
  • "property2": "string"
}

LogUserEvent logs a user event

Logs a user event to the database

Request Body schema: application/json

Log User Event Request

error_message
string
event
required
string
user_id
string

Responses

Request samples

Content type
application/json
{
  • "error_message": "string",
  • "event": "string",
  • "user_id": "string"
}

Response samples

Content type
application/json
{
  • "property1": "string",
  • "property2": "string"
}

GetLogsByUserID retrieves logs for a specific user

Fetches logs from the database for a specific user ID

path Parameters
user_id
required
string

ID of the user

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Status

GetAIUsage retrieves AI usage statistics

Fetches AI usage statistics from the database

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Suggestions

/api/v1/suggestion/{mode}

path Parameters
mode
required
string

Suggestion mode: code_block, line_by_line, code_selection

Request Body schema: application/json

Suggestion request payload

bugPercentage
integer
classId
string
fileName
string
language
string
prompt
string
rawText
string
userId
string

Responses

Request samples

Content type
application/json
{
  • "bugPercentage": 0,
  • "classId": "string",
  • "fileName": "string",
  • "language": "string",
  • "prompt": "string",
  • "rawText": "string",
  • "userId": "string"
}

Response samples

Content type
application/json
{ }

GetSuggestionByModeAndId retrieves a suggestion based on mode and ID

Fetches a suggestion from the database based on the provided mode and suggestion ID

path Parameters
mode
required
string

Mode of the suggestion (CODE_BLOCK, LINE_BY_LINE, CODE_SELECTION)

suggestion_id
required
string

ID of the suggestion

Responses

Response samples

Content type
application/json
null

Users

Get all users

Retrieves all user's details.

Responses

Get classes by student ID

Retrieves all classes a specific student is enrolled in.

path Parameters
student_id
required
string

Student ID

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get a user by ID

Retrieves user details based on the user ID.

path Parameters
user_id
required
string

User ID

Responses

Delete a user by ID

Deletes a user and their associated data based on the user ID.

path Parameters
user_id
required
string

User ID

Responses

Update a user by ID

Updates a user's details based on the user ID. Fields are optional.

path Parameters
user_id
required
string

User ID

Responses

Response samples

Content type
application/json
{
  • "property1": "string",
  • "property2": "string"
}

Update user settings

Updates the settings for a specific user based on their ID.

path Parameters
user_id
required
string

User ID

Request Body schema: application/json

User Settings Payload

bugPercentage
integer
enableDashboard
boolean
enableQuiz
boolean
mode
string
showNotifications
boolean
test_group
string

Responses

Request samples

Content type
application/json
{
  • "bugPercentage": 0,
  • "enableDashboard": true,
  • "enableQuiz": true,
  • "mode": "string",
  • "showNotifications": true,
  • "test_group": "string"
}

Response samples

Content type
application/json
{
  • "property1": "string",
  • "property2": "string"
}